Treat subscripted generics as "proxies" for original class.#393
Merged
ilevkivskyi merged 3 commits intopython:masterfrom Feb 23, 2017
Merged
Treat subscripted generics as "proxies" for original class.#393ilevkivskyi merged 3 commits intopython:masterfrom
ilevkivskyi merged 3 commits intopython:masterfrom
Conversation
Member
|
I think we should get this in.
…--Guido (mobile)
On Feb 23, 2017 3:38 AM, "Ivan Levkivskyi" ***@***.***> wrote:
Fixes #392 <#392>
As noted by @JukkaL <https://github.com/JukkaL>, conceptually,
subscripting generic classes should not create independent class objects
(type should be erased at runtime). In particular, class variables should
be shared between subscripted generics and original class.
Here I implement this semantics using a custom __setattr__.
@gvanrossum <https://github.com/gvanrossum> There is a question (assuming
we agree that this is needed) whether this should go in 3.6.1 that has
"feature freeze" in less than a week, or should we postpone this until
3.6.2?
------------------------------
You can view, comment on, or merge this pull request online at:
#393
Commit Summary
- Initial implementation (tests and PY2 port needed)
- Tests and PY2 backport
File Changes
- *M* python2/test_typing.py
<https://github.com/python/typing/pull/393/files#diff-0> (27)
- *M* python2/typing.py
<https://github.com/python/typing/pull/393/files#diff-1> (7)
- *M* src/test_typing.py
<https://github.com/python/typing/pull/393/files#diff-2> (27)
- *M* src/typing.py
<https://github.com/python/typing/pull/393/files#diff-3> (7)
Patch Links:
- https://github.com/python/typing/pull/393.patch
- https://github.com/python/typing/pull/393.diff
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#393>, or mute the thread
<https://github.com/notifications/unsubscribe-auth/ACwrMtMGXHeWhiWbk3z68YOZjejValsTks5rfYvJgaJpZM4MJ-Ok>
.
|
Member
Author
OK, I am going to merge this soon (unless you or @JukkaL express any concerns), and will then make a PR to |
Member
Author
|
OK, so here is the PR to |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #392
As noted by @JukkaL, conceptually, subscripting generic classes should not create independent class objects (type should be erased at runtime). In particular, class variables should be shared between subscripted generics and original class.
Here I implement this semantics using a custom
__setattr__.@gvanrossum There is a question (assuming we agree that this is needed) whether this should go in 3.6.1 that has "feature freeze" in less than a week, or should we postpone this until 3.6.2?